package snail.tiger.com.tigerplayer;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import snail.tiger.com.tigerplayer.tools.SharedPreferencesUtils;
import snail.tiger.com.tigerplayer.tools.AudioPlayerUtil;
import snail.tiger.com.tigerplayer.users.User;
import snail.tiger.com.tigerplayer.views.TigerView;

public class MainActivity extends AppCompatActivity {

    private TigerView mTigerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();
    }

    private void init() {
        SharedPreferencesUtils.init(this);
        AudioPlayerUtil.getInstance().init(this);

        User.SCORE = SharedPreferencesUtils.getInt("userScore", User.SCORE);

        mTigerView = findViewById(R.id.tiger);
        mTigerView.showScore();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        AudioPlayerUtil.getInstance().releaseSound();
    }
}
